<?php
header ("Content-Type:text/html; charset= utf-8");
require_once ('config.php');
require_once (WEBURL.'/include/conn.php');
require_once (WEBURL.'/login_status_check.php');
if(!isset($_GET['article_id'])){
	echo "forbidden!";
	exit();
}
if(!checkLogin()){
	    $id=$_GET['article_id'];
		$gotopage=base64_encode("article_modify.php?article_id=".$id);
	header("Location:admin_login.php?gotopage=".$gotopage);
	
}
else{
	require_once (WEBURL.'/channel.class.php');
	$_SESSION['file_upload_allowed']="allowed";
	/*标题及栏目信息*/
	$smarty->assign("title","修改文章");
	$channel=new Channel();
	$all_channel=$channel->getAllChannel("article");
	$smarty->assign("all_channel",$all_channel);
	
	/*获取文章信息*/
	$article_id=$_GET['article_id'];
	$article_information_tmp=$channel->getArticleInformation($article_id);
	if($article_information_tmp==""){
		echo "不存在该id的文章！";
		exit();
	}
	$article_information=explode("|",$article_information_tmp);
	//print_r($article_information);	
	/*文章信息模版化*/
	$smarty->assign("article_id",$article_id);
	$smarty->assign("article_title",$article_information[1]);
	$smarty->assign("article_is_extends_url",$article_information[2]);
	$smarty->assign("article_extends_url",$article_information[3]);
	$smarty->assign("article_from",$article_information[4]);
	$smarty->assign("article_writer",$article_information[5]);
	$smarty->assign("article_main_channel",$article_information[6]);
	$smarty->assign("article_has_picture",$article_information[8]);
	$smarty->assign("article_picture_path",$article_information[9]);
	$smarty->assign("article_clicked_times",$article_information[10]);
	$smarty->assign("article_publish_time",$article_information[11]);
	$smarty->assign("article_is_top",$article_information[14]);
	$smarty->assign("article_is_top_time",date("Y-m-d H:i:s",$article_information[15]));
        $smarty->assign("article_content",base64_decode($article_information[16]));
	$smarty->assign("time",date("Y-m-d H:i:s",$article_information[11]));

	$smarty->display("article_modify.htm",md5("article_modify.php?article_id=".$article_id));
}

